var app = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    but:"加 入",
    tab_index: 0
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    let that = this;
    var openid = app.globalData.openid;
    app.ihttpGet("https://www.58zltc.com/api.php/Quan/circle/openid/"+openid,function(res){
        that.setData({
          list:res.data
        })
    })
  },
  backto:function(e){
    wx.navigateBack({})
  },
  follow:function(e){
    var openid = app.globalData.openid;
    var id = e.currentTarget.dataset.id;
    var t =this
    app.ihttpGet("https://www.58zltc.com/api.php/Quan/circle_follow/openid/"+openid+"/id/"+id, function (res) {
      if (res.data.err_code){
        wx.showToast({
          icon:"none",
          title: res.data.err_msg,
        })
        setTimeout(function(){
          t.onLoad()
        },1000)
      }else{
        wx.showToast({
          title: res.data.err_msg,
        })
        t.onLoad()
      }
    })
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
  
  },
  changeTab: function (e) {
    this.setData({
      tab_index: e.currentTarget.dataset.tab_index
    })
  }
})